// pages/distribution/mymember.js

const api = require("../../request/api")
const request = require("../../request/request")
const util = require("../../utils/util")
const App = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    uid: 1,
    shop_id: 0,
    user_type: ['', '店员', '经理', '物流', '财务', '店长'],
    mymember_list: [],
    shopdetail_data: {},

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.init_data(options)
    this.get_shopmember()
    this.get_shopdetail()

  },

  get_shopdetail() {
    let params = {
      id: this.data.shop_id,
    }
    request.post(api.shopdetail, params).then(res => {
      this.setData({
        shopdetail_data: res,
      })
    })
  },

  init_data() {
    let shop_id = App.globalData.eshop_id
    this.setData({
      uid: util.getAppValue(App.globalData.uid),
      shop_id
    })
  },

  get_shopmember() {
    let params = {
      sid: this.data.shop_id
    }
    request.post(api.shopmemberlist, params).then(res => {
      this.setData({
        mymember_list: res
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})